<?php
/* 
 * Copyright (c) 2018-2021   All rights reserved.
 * 
 * 创建时间：2021-05-20 23:57
 *
 * 项目：upload  -  $  - editor.php
 *
 * 作者：liwei 
 */

echo \lev\base\Assetsv::registerJsFile('@assets/statics/editor/wangEditor.min.js', 1);
?>

<div class="page">
    <div class="page-content">
        <div id="div1">
            <p>欢迎使用 <b>wangEditor</b> 富文本编辑器</p>
        </div>

        <a class="button button-fill getEditorJosn">获取JSON</a>
        <pre class="pre">

        </pre>
    </div>
</div>

<!-- 引入 wangEditor.min.js -->
<script type="text/javascript">
    (function () {
        'use strict';

        jQuery('.getEditorJosn').click(function () {
            console.log(editor.txt.getJSON());
            jQuery('.pre').html(JSON.stringify(editor.txt.getJSON()));
        });

        const E = window.wangEditor;
        const editor = new E('#div1');
        // 或者 const editor = new E( document.getElementById('div1') )
        editor.create();
    })();
</script>